package com.example.hybridmobiledemo.module.main.model.traffic;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.OrientationHelper;
import androidx.recyclerview.widget.RecyclerView;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.example.hybridmobiledemo.R;
import com.example.hybridmobiledemo.module.main.model.traffic.bean.Bus;
import com.example.hybridmobiledemo.view.BusAdapter;

import java.util.ArrayList;
import java.util.List;

public class BusList extends AppCompatActivity {
    private List<Bus> list = new ArrayList<>();
    private RecyclerView busList;
    private TextView parking;
    private TextView backBus;
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_bus_list);
        initView();
        initData();

        backBus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        parking.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(BusList.this, ParkingDetails.class));
            }
        });
    }

    private void initData() {
        for (int i = 0; i < 8; i++) {
            String a = String.valueOf(i);

            list.add(new Bus(a, a, a, a));


        }
    }


    @SuppressLint("WrongConstant")
    private void initView() {
        busList = (RecyclerView) findViewById(R.id.bus_list);
        busList.setAdapter(new BusAdapter(this, list));
        busList.setLayoutManager(new LinearLayoutManager(this, OrientationHelper.VERTICAL,false));
        parking = (TextView) findViewById(R.id.parking);
        backBus = (TextView) findViewById(R.id.back_bus);
        textView = (TextView) findViewById(R.id.textView);
    }
}